-
Notifications
You must be signed in to change notification settings - Fork 19
Progress bars when sampling multiple chains #168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
penelopeysm
wants to merge
25
commits into
main
Choose a base branch
from
py/parallel-combined
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+353
−87
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6c3d929
to
8eec9e9
Compare
AbstractMCMC.jl documentation for PR #168 is available at: |
8a9d376
to
1195503
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces more informative progress bars with
MCMCThreads
which can be configured by the user (see options below).In today's meeting it was generally agreed that having one progress bar per chain was more informative / useful, and that an upper bound could be placed to disable that by default if there were more than
MAX_CHAINS_PROGRESS
chains.This PR sets
MAX_CHAINS_PROGRESS = 10
. The user can override the default on a case-by-case basis using theSymbol
versions ofprogress
, or can globally set the threshold usingsetmaxchainsprogress!(N)
.For
MCMCSerial
no change is made (it already had one progress bar per chain).For
MCMCDistributed
,progress = :overall
is implemented (progress = true
is a synonym for that) butprogress = :perchain
isn't, not for any good technical reason, but because it was just too much of a faff. I think that in principle it's possible to implement it similarly to how it's done for MCMCThreads (i.e., generate one UUID per chain), but I think each chain has to communicate back to the parent worker using aRemoteChannel
, and there needs to be a way of disentangling the inputs from different chains (so you either need NRemoteChannel
s or the channel needs to take a chain ID). I suppose if somebody really, really wants it I could do it, but given that:overall
already works I am hoping nobody will complain.In a technical sense this is accomplished by passing richer objects in the
progress
keyword argument (seesrc/logging.jl
). This does mean that people should not overrideprogress
in their own implementations (I have added a warning in the docs) but it is IMO better than using callbacks.The videos below demonstrate the behaviour for
MCMCThreads
.Closes #82
Closes TuringLang/Turing.jl#2264
Setup
progress=:perchain
perchain.mov
progress=:overall
overall.mov
progress=true
true.mov
progress=false
orprogress=:none
false.mov
Bonus:
:perchain
and:overall
on Pluto (it's pretty)Screen.Recording.2025-06-30.at.23.51.20.mov
Bonus:
:perchain
in iJulia (in VSCode; it's not pretty)Screen.Recording.2025-06-30.at.23.59.19.mov
Bonus:
:overall
in iJulia (works fine)Screen.Recording.2025-06-30.at.23.59.46.mov